class Mailer < ActionMailer::Base
	def test(to, text, from=EVENT_EMAIL_ADDRESS)
	  @recipients = to
	  @from = from
	  @subject = "Test Message #{DateTime.now}"

	  @body[:text] = text
	end

	def invitation_request_confirmation(invitation_request)
		initialize_invitation_request_email_values invitation_request
		@subject = "#{EVENT_NAME} Invitation Request Confirmation"
	end

	def invitation_request_organizer_notification(invitation_request)
		@recipients = REGISTRATION_NOTIFICATION_EMAIL_ADDRESS
		@from = EVENT_EMAIL_ADDRESS
		@subject = "Invitation Request for #{EVENT_NAME}"
		@body[:person] = invitation_request.person
		@body[:invitation_request] = invitation_request
	end

	def invitation_request_status(invitation_request)
		initialize_invitation_request_email_values invitation_request
		@subject = "Invitation Request Status for #{EVENT_NAME}"
	end
	
	def invitation_request_declined(invitation_request)
		initialize_invitation_request_email_values invitation_request
		@subject = "Invitation Request for #{EVENT_NAME}"
	end
	
	def invitation_request_accepted(invitation_request)
		initialize_invitation_request_email_values invitation_request
		@subject = "Accepted Invitation Request for #{EVENT_NAME}"
	end
	
	def reset_password(person, new_password)
		@recipients = person.email_address
		@from = EVENT_EMAIL_ADDRESS
		@subject = "Password Reset for #{EVENT_NAME} Website"
		@body[:person] = person
		@body[:password] = new_password
	end
	
	protected
	def initialize_invitation_request_email_values(invitation_request)
		@recipients = invitation_request.person.email_address
		@from = EVENT_EMAIL_ADDRESS
		@body[:person] = invitation_request.person
		@body[:invitation_request] = invitation_request
	end
end
